﻿using System;

namespace WorldRacing2.Configuration
{
    internal class WR2ConfigurationDialog : ConfigurationDialog
    {
        #region Private Fields

        private ObjectsProperties.ObjectPropertyControl objectPropertyControl;
        private Material.TextureSetupWindow textureSetupWindow;
        private Configuration.WorldRacing2Folder worldRacing2Folder;

        #endregion Private Fields

        #region Public Constructors

        public WR2ConfigurationDialog() : base()
        {
            this.ConfigurationData = new WorldRacing2ConfigurationData();

            // Initialisize all controls and add them.
            this.worldRacing2Folder = new Configuration.WorldRacing2Folder(this.ConfigurationData);
            this.AddControl("Folder", this.worldRacing2Folder);
            this.objectPropertyControl = new ObjectsProperties.ObjectPropertyControl(this.ConfigurationData);
            this.AddControl("Object Properties", this.objectPropertyControl);
            this.textureSetupWindow = new Material.TextureSetupWindow(this.ConfigurationData);
            this.AddControl("Texture to Material", textureSetupWindow);
        }

        #endregion Public Constructors

        #region Public Properties

        public WorldRacing2ConfigurationData ConfigurationData { get; set; }

        #endregion Public Properties

        #region Public Methods

        public void OnMaterialEditorChange(object sender, EventArgs e)
        {
            this.textureSetupWindow.SetMaterialManager((Engine.Graphics.MaterialManager)sender);
        }

        #endregion Public Methods

        #region Internal Methods

        internal void ImportTexturesFromGame(string sceneryEditorTextureFolder)
        {
            this.worldRacing2Folder.ImportTexturesFromWR2(sceneryEditorTextureFolder);
        }

        #endregion Internal Methods
    }
}